/* NumberValidator.java
 *
 * @author Medisoft (Team D)
 * @date 15.04.2008
 *
 * Number Validator Klasse
 */

package ocumed.teams.teamd.gui;

import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.JTextField;

/**
 * Ocumed
 * 
 * @author Medisoft (Team D)
 * @version 1.0
 * @see Object
 */
public class DoubleValidator extends AbstractValidator {
	public DoubleValidator(JDialog parent, JTextField c, String message) {
		super(parent, c, message);
	}

	protected boolean validationCriteria(JComponent c) {

		String number = ((JTextField) c).getText();

                if (number.length() == 0){
                    return true;
                }
                
		try {

			Double.parseDouble(number);
			
			return true;

		} catch (NumberFormatException e) {
			
		}

		return false;
	}
}
